//实现函数组合

const compose = (a, b) => {
  return (value) => {
    return a(b(value));
  };
};

const reverse = (array) => {
  return array.reverse();
};

const first = (array) => {
  return array[0];
};

const last = compose(first, reverse);
console.log(last([1, 2, 3, 4]));
